class StageController {

    def index = { }

  def stage = {
    []
  }

  def month = {
    def months = []
    def yearStage = 0
    if(params.id?.length() > 0 && params.id != 'undefined') yearStage = params.id.substring(1).toInteger()
    if(yearStage == 10000){
      (0 .. 9).each{
        months.add( 10000 + it*30)
      }
    } else if(yearStage >= 20000){
      (0 .. 11).each{
        months.add( yearStage + it*30)
      }
    }
    [months:months]
  }

  def week = {
    def weeks = []
    if(params.id == '10000X'){
       def monthStage = 10000
      (0 .. 40).each {
        weeks.add( monthStage + it*7)
      }
    } else {
      def monthStage = params.id.toInteger()
      (0 .. 4).each{
        weeks.add( monthStage + it*7)
      }
    }
    [weeks:weeks]
  }  
}
